<style>
    .layui-form-label {
        width: 100px;
    }

    .layui-input-block {
        margin-left: 130px;
    }
</style>
<div class="rightcontent rc-bg-grey">
    <div class="rc-pagepadding">

        <div class=" rc-pannel ">
            <div class="rc-pannel-body layui-form">

                <div class="layui-tab layui-tab-brief">

                    <ul class="layui-tab-title">
                        <?php
                        foreach ($tables as $key => $value) {
                        ?>
                            <li class="<?php echo $key == 0 ? 'layui-this' : '' ?>"><?php echo $value['title'] ?></li>
                        <?php

                        }
                        ?>
                    </ul>

                    <div class="layui-tab-content">

                        <?php

                        foreach ($tables as $key => $table) {
                            if (!$table['infomation']) {
                                continue;
                            }

                        ?>
                            <div class="layui-tab-item <?php echo $key == 0 ? 'layui-show ' : '' ?> rc-pagepadding">
                                <?php
                                if ($table['multiline'] == 1) {
                                ?>
                                    <table class="layui-table">
                                        <colgroup>
                                            <?php
                                            foreach ($table['fields'] as $field) {
                                            ?>
                                                <col>
                                            <?php
                                            }
                                            ?>
                                        </colgroup>
                                        <thead>
                                            <tr>
                                                <?php
                                                foreach ($table['fields'] as $field) {
                                                ?>
                                                    <th><?php echo $field['title']; ?></th>
                                                <?php
                                                }
                                                ?>

                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                            foreach ($table['infomation'] as $infomation) {
                                            ?>
                                                <tr>
                                                    <?php
                                                    foreach ($table['fields'] as $field) {
                                                    ?>
                                                        <td><?php echo $infomation[$field['name']]; ?></td>
                                                    <?php
                                                    }
                                                    ?>

                                                </tr>
                                            <?php
                                            }
                                            ?>


                                        </tbody>

                                    </table>
                                <?php
                                } else {
                                ?>
                                    <form class="layui-form">
                                        <?php
                                        foreach ($table['fields'] as $field) {
                                        ?>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label"><?php echo  $field['title'] ?></label>
                                                <div class="layui-input-block" style="padding-top: 5px;">
                                                    <?php echo isset($table['infomation'][$field['name']]) ? $table['infomation'][$field['name']] : ''; ?>
                                                </div>
                                            </div>
                                        <?php
                                        }
                                        ?>

                                    </form>

                                <?php
                                }
                                ?>
                            </div>
                        <?php
                        }
                        ?>

                    </div>

                </div>

            </div>


        </div>

    </div>
</div>


<script>
    layui.use(function() {

        var layer = layui.layer;
        var form = layui.form;
        form.on('submit(saveupload)', function(data) {
            var data = data.field;
            $.ajax({
                url: '/admin/cnf/Syscnf/setUpload', //请求路径
                type: "POST", //请求方式
                data: data, // 默认写法
                success: function(data) {
                    if (data.code == 0) {
                        toastr_success("设置成功", function() {});
                    } else {
                        toastr_error(data.message);
                    }
                },
                error: function() {

                },

            });
        });

        form.on('submit(logregcnf)', function(data) {
            var data = data.field;
            console.log(data);
        });

    });
</script>